<div class='head'>
	$lang.get('title.welcome') <b>$!me.nickname</b>
	<span class='right'>
		#if($me.hasAccess('access.config.admin'))
		<a href='javascript:;' class='btn btn-danger' onclick="_showrestart()">$lang.get('a.restart')</a>
		#end
	</span></div>

<div class='chart'>
	<iframe class='cpu_gauge' src="/admin/gauge/tps"></iframe>
	<iframe class='mem_gauge' src="/admin/gauge/mem"></iframe>
	<iframe class='disk_usage' src="/admin/gauge/disk"></iframe>
</div>

<div class='state' style='display:block;'>
	<div class='login'>$lang.get('label.node'):$!node</div>
	<div class='uptime'>$lang.get('label.uptime'):<span class='uptime'>$uptime</span>, $lang.get('label.past'):<span class='past'>$past</span></div>
	<div class='release'>$lang.get('label.release'):$!release</div>
	<div class='build'>$lang.get('label.build'):$!build</div>
	<div class='build'>$lang.get('label.now'):$!now</div>
	
</div>

<div id='restart' title="$lang.get('title.restart.service')" style="display:none">
	<div><label><h3>$lang.get('user.password'):</h3><input type='password' name='password'/></label></div>
	<button onclick='_restart();'>$lang.get('btn.ok')</button>
</div>

<script>
var _timer = false;
function _showrestart(){
	$('#restart').dialog({modal : true,close:function(e,ui){$(this).dialog('destroy');}});
}
function _restart(){
	
	processing && processing.show();
	$.post('/admin/system/restart', {pwd:$('#restart input[name=password]').val()}, function(d){
		if(d.state == 'ok') {
			$('#restart').dialog('close');
			_timer = setInterval(_load, 5000);
		} else {
			processing && processing.hide();
			$.error(d.message);
		}
	})
}

function _load() {
	$.get('/admin/dashboard', {}, function(d){
		window.location.href = window.location.href;
	});
}
</script>
